//
//  PropertyReparisTextViewTableViewCell.m
//  PropertyManager
//
//  Created by TNG on 2018/7/17.
//  Copyright © 2018年 Tng. All rights reserved.
//

#import "PropertyReparisTextViewTableViewCell.h"

@implementation PropertyReparisTextViewTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

-(instancetype) initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self creatUI];
        self.separatorInset = UIEdgeInsetsMake(0, 0, 0, MAXFLOAT);
    }
    return self;
}

-(void)creatUI{
    [self.contentView addSubview:self.textView];
    [self.contentView addSubview:self.placeLabel];
}

-(UITextView *)textView
{
    if (_textView == nil) {
        _textView = [[UITextView alloc] initWithFrame:CGRectMake(17 , 10, WIDTH - 32, 130)];
        _textView.font = font(16);
        _textView.delegate = self;
        _textView.textColor = SFM51;
    }
    return _textView;
}

-(UILabel *)placeLabel
{
    if (_placeLabel == nil) {
        _placeLabel =[[UILabel alloc]initWithFrame:CGRectMake(23, 19, WIDTH - 42, 20)];
        _placeLabel.font =font(16);
        _placeLabel.textColor=SFMColor(196, 196, 200);
        _placeLabel.text = @"请输入您的简介……";
        _placeLabel.textAlignment=NSTextAlignmentLeft;
    }
    return _placeLabel;
}

-(void)textViewDidChange:(UITextView *)textView
{
    self.PropertyReparisTextViewTableViewCellInpuEventBlock(self.textView.text);
}

- (void)textViewDidChangeSelection:(UITextView *)textView
{
    if (textView.text.length == 0) {
        self.placeLabel.hidden = NO;
    }
    else {
        self.placeLabel.hidden = YES;
    }
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
